const db = require('./mysql')
 
class CommonModel {
  async getUserByName (username) {
    return await db.query(`select * from db_sqlweb.t_comment where name='${username}'`)
  }
  // 插入一条数据到mysql数据库
  async insertComment (name,content) {
    console.log(`INSERT INTO t_comment (name, content) VALUES (${name}, ${content})`)
    return await db.query(`INSERT INTO t_comment (name, content) VALUES ('${name}', '${content}')`)  
    // return await db.query(`INSERT INTO t_comment (name, content) VALUES (${name}, ${content})`)
  }
}
 
module.exports = new CommonModel()